package com.teradyne.merlin2.ui.client.views;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.teradyne.merlin2.ui.client.resources.MerlinStyle;

public class ServicesMenuViewImpl extends Composite implements ServicesMenuView {

	private static ServicesMenuViewImplUiBinder uiBinder = GWT.create(ServicesMenuViewImplUiBinder.class);

	interface ServicesMenuViewImplUiBinder extends UiBinder<Widget, ServicesMenuViewImpl> {
	}

	@UiField
	Anchor ancServiceRequestList;

	@UiField
	Anchor ancServiceInstallProblem;

	@UiField
	Anchor ancServiceAddAddress;
	
	@UiField
	Anchor ancServiceChangeAddress;

	@UiField
	Anchor ancServiceOther;


	private Presenter presenter;

	@Inject
	public ServicesMenuViewImpl(MerlinStyle merlinStyle) {
		initWidget(uiBinder.createAndBindUi(this));
	}

	@Override
	public void setPresenter(Presenter presenter) {
		this.presenter = presenter;
	}
	
	@UiHandler("ancServiceRequestList")
	void onServiceListClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onServiceListClicked();
		}
	}

	@UiHandler("ancServiceInstallProblem")
	void onServiceInstallProblemClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onServiceInstallProblemClicked();
		}
	}

	@UiHandler("ancServiceAddAddress")
	void onAddAddressClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onAddAddressClicked();
		}
	}
	
	@UiHandler("ancServiceChangeAddress")
	void onChangeAddressClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onChangeAddressClicked();
		}
	}

	@UiHandler("ancServiceOther")
	void onOtherServiceClicked(ClickEvent event) {
		if (presenter != null) {
			presenter.onOtherServiceClicked();
		}
	}

//	@Override
//	public HasClickHandlers getHandlerServiceList() {
//		return ancServiceRequestList;
//	}
//
//	@Override
//	public HasClickHandlers getHandlerServiceInstallProblem() {
//		return ancServiceInstallProblem;
//	}
//
//	@Override
//	public HasClickHandlers getHandlerAddAddress() {
//		return ancServiceAddAddress;
//	}
//
//	@Override
//	public HasClickHandlers getHandlerChangeAddress() {
//		return ancServiceChangeAddress;
//	}
//
//	@Override
//	public HasClickHandlers getHandlerOtherService() {
//		return ancServiceOther;
//	}

}
